check button: Match documented behavior
authorMatthias Clasen <mclasen@redhat.com>
Tue, 3 Nov 2015 04:06:57 +0000 (23:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 3 Nov 2015 04:06:57 +0000 (23:06 -0500)
We were not actually adding the style classes that the
documentation is talking about, for the !draw-indicator case.
Fix that.

gtk/gtkcheckbutton.c

index 16f0bf2c8951abfd149d317254ff80184128ba41..c1963f3e4baaa03075653de401f16923422c5fe5 100644 (file)
@@ -169,16 +169,31 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     {
       gtk_button_set_alignment (button, 0.0, 0.5);
       gtk_css_node_set_visible (priv->indicator_node, TRUE);
-      if (GTK_IS_CHECK_BUTTON (button))
-        gtk_css_node_set_name (widget_node, I_("checkbutton"));
-      else if (GTK_IS_RADIO_BUTTON (button))
-        gtk_css_node_set_name (widget_node, I_("radiobutton"));
+      if (GTK_IS_RADIO_BUTTON (button))
+        {
+          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("radio"));
+          gtk_css_node_set_name (widget_node, I_("radiobutton"));
+        }
+      else if (GTK_IS_CHECK_BUTTON (button))
+        {
+          gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("check"));
+          gtk_css_node_set_name (widget_node, I_("checkbutton"));
+        }
     }
   else
     {
       gtk_button_set_alignment (button, 0.5, 0.5);
       gtk_css_node_set_visible (priv->indicator_node, FALSE);
-      gtk_css_node_set_name (widget_node, I_("button"));
+      if (GTK_IS_RADIO_BUTTON (button))
+        {
+          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("radio"));
+          gtk_css_node_set_name (widget_node, I_("button"));
+        }
+      else if (GTK_IS_CHECK_BUTTON (button))
+        {
+          gtk_css_node_add_class (widget_node, g_quark_from_static_string ("check"));
+          gtk_css_node_set_name (widget_node, I_("button"));
+        }
     }
 G_GNUC_END_IGNORE_DEPRECATIONS
 }